home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CUJ9209.ARJ / 1009114A < prev    next >
Text File  |  1992-07-13  |  591b  |  34 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. char *string[] = {
  5.    "some garbageR A 3 4",
  6.    "R A 3 0 4"
  7.    };
  8.  
  9. const char *format = "%*[^PR]%c %c %d %d %d";
  10.  
  11. void main(void);
  12.  
  13. void main(void)
  14.    {
  15.  
  16.      int ret;
  17.      int i;
  18.      int k=0, n=0, m=0;
  19.      char 1=0, q=0;
  20.  
  21.      for (i=0; i<2; i++)
  22.        {
  23.        ret = sscanf (string[i], format, &1, &q, &k, &m, &n);
  24.        if (ret !=5)
  25.           {
  26.           printf ("SSCANF FAIL string[%d]!\n", i);
  27.           } 
  28.        else 
  29.            {
  30.            printf ("SSCANF OK string[%d]!\n", i);
  31.           }
  32.        }
  33.    }
  34.